package com.wyw.design.model.learning.behavioral.memo;

/**
 * @Title
 * @Description Originator是一个银行账户类，Memento是用于保存账户的状态的类，Caretaker是保存并交互备忘录的类。
 * @Author Mr Wu yewen.wu.china@gmail.com
 * @Date 2023/4/20 11:16
 * Update History:
 * Author        Time            Content
 */
public class Client {
    public static void main(String[] args) {
        BankAccount account = new BankAccount(1000);
        BankAccountManager manager = new BankAccountManager(account);

        manager.deposit(500);
        System.out.println(account.getBalance()); // 1500

        manager.withdraw(200);
        System.out.println(account.getBalance()); // 1300

        manager.undo();
        System.out.println(account.getBalance()); // 1300
    }
}
